//
//  RZLatestMessageInfo.h
//  RZIM
//
//  Created by reyzhang on 2021/8/2.
//  接口返回的消息模型

#import <Foundation/Foundation.h>
#import "RZMessage.h"
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/**
 {
gid = 582091447263776768;
id = 582091450032848896;
mid = 582091448282992640;
msg = "lisi\U9080\U8bf7zhangsan\U52a0\U5165\U7fa4\U7ec4";
msgState = 0;
msgTime = "2021-08-02 16:30:26";
msgType = 0;
offline = 1;
subType = 4;
tid = 123;
uid = 456;
}
 */


/*!
 消息的方向
 */
typedef NS_ENUM(NSUInteger, RZMessageDirection) {
    /*!
     发送
     */
    MessageDirection_SEND = 1,

    /*!
     接收
     */
    MessageDirection_RECEIVE = 2
};

@interface RZMessageInfo : NSObject
@property (nonatomic, strong) NSString *gid;
@property (nonatomic, assign) NSInteger mid;
@property (nonatomic, strong) NSString *msg;
@property (nonatomic, strong) NSString *msgTime;

@property (nonatomic, assign) NSInteger msgState;
@property (nonatomic, assign) NSInteger msgType; // 0:系统消息 1：聊天消息

@property (nonatomic, assign) NSInteger offline;
//消息类型
@property (nonatomic, assign) NSInteger subType; // 101: 文本消息 102:音频 103:视频 104：图片 105：文件
@property (nonatomic, strong) NSString *tid;
@property (nonatomic, strong) NSString *uid;
@property (nonatomic, strong) NSString *userAvatar;
@property (nonatomic, strong) NSString *username;
@property (nonatomic, strong) id extraData; //使用时需要转成对象




//扩展
@property (nonatomic, assign) CGSize cellSize;
@property (nonatomic, assign) BOOL isDisplayNickname;
@property (nonatomic, strong,readonly) id extraInfo; //extraData的特殊处理


//消息方向
@property (nonatomic, assign,readonly) RZMessageDirection messageDirection;
//会话类型
@property (nonatomic, assign) RZConversationType conversationType;

/**
 socket消息 转换
 */
+ (instancetype)createWithSocketMessage:(RZMessage *)message;

@end



#pragma mark - 语音消息 extraData
@interface RZVoiceMessageModel :  NSObject

@property (nonatomic, assign) NSInteger duration; //音频时长

@end

#pragma mark - 图片消息 extraData
@interface RZImageMessageModel : NSObject

@property (nonatomic, assign) CGFloat width; //图片宽度
@property (nonatomic, assign) CGFloat height; //图片高度

@property (nonatomic, strong) UIImage *thumbImage; //缩略图
@end

#pragma mark - 视频消息 extraData
@interface RZVideoMessageModel : NSObject

@property (nonatomic, assign) CGFloat width; //第一帧图片宽度
@property (nonatomic, assign) CGFloat height; //第一帧图片高度

@property (nonatomic, strong) UIImage *thumbImage; //第一帧缩略图
@property (nonatomic, strong) NSString *imageUrl; //第一帧图片地址

@property (nonatomic, assign) NSInteger duration; //视频时长
@end


NS_ASSUME_NONNULL_END
